import React,{Component} from 'react';
import {SafeAreaView, StatusBar} from "react-native";
import SplashScreen from 'react-native-splash-screen'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import WelcomePage from "../pages/WelcomePage";
import HomePage from "../pages/HomePage";
import DetailPage from "../pages/DetailPage";
import WebViewPage from '../pages/WebViewPage';
import AboutPage from "../pages/AboutPage";
import AboutAuthorPage from "../pages/AboutAuthorPage";
import BlogPage from '../pages/BlogPage';
import CustomLanguage from "../pages/CustomLanguage";
import LanguageSortable from "../pages/LanguageSortable";

const Stack = createStackNavigator();

export default class AppNavigators extends Component{
  render(){
    return <>
      <StatusBar hidden/>
      <SafeAreaView style={{flex:1}}>
        <NavigationContainer>
          <Stack.Navigator>
            {/* 广告页 */}
            <Stack.Screen name="WelcomePage" component={WelcomePage} options={{
              headerShown:false}
            }/>
            {/* 首页 */}
            <Stack.Screen name="HomePage" component={HomePage} options={{
              headerShown:false
            }}/>
            {/* 详情页 */}
            <Stack.Screen name="DetailPage" component={DetailPage} options={{
              headerShown:false
            }}/>
            {/* 教程 */}
            <Stack.Screen name="WebViewPage" component={WebViewPage} options={{
              headerShown:false
            }}/>
            {/* 关于页面详情 */}
            <Stack.Screen name="AboutPage" component={AboutPage} options={{
              headerShown:false
            }}/>
            {/* 关于作者详情页面 */}
            <Stack.Screen name="AboutAuthorPage" component={AboutAuthorPage} options={{
              headerShown:false
            }}/>
            {/* 关于博客页面 */}
            <Stack.Screen name="BlogPage" component={BlogPage} options={{
              headerShown:false
            }}/>
            {/* 自定义语言页面 */}
            <Stack.Screen name="CustomLanguage" component={CustomLanguage} options={{
              headerShown:false
            }}/>
            {/* 语言排序页面 */}
            <Stack.Screen name="LanguageSortable" component={LanguageSortable} options={{
              headerShown:false
            }}/>
          </Stack.Navigator>
        </NavigationContainer>
      </SafeAreaView>
    </>
  }

  componentDidMount() {
    // 渲染完毕，隐藏启动屏
    SplashScreen.hide();
  }
}
